Add Git Tools to Navigator#51
Conversation
|
I've no issue with any of the code here, but would you mind setting up the formatting tool chain? It's essentially: uv pip install pre-commit Will let you know the formatting errors/fix a few of them |
|
Sorry, it's my first time working with Aider codebase. I will try to wrangle the code into the correct format. |
removed un-used import in git.py, navigator_coder.py
|
The pre-commit now reports no errors. I'm just testing some more after re-installing. And getting confused between github accounts.. |
|
So I have been using Aider with this new git tools for a couple of days now - no errors to report I think the main question is whether anyone needs this - considering the already present command_string tool. I would like to think of this as the start of a more comprehensive git tool which can handle complex merges and re-base etc (the hard stuff) safely, acting as a guide to the LLM. Would love to hear other's thoughts on this. Will having only part of git functionality handled by this tool (for now) be confusing? It confused me a bit when command_string took over. I am a bit scared of the command_string tool tbh it has done some stuff I didn't ask it to, but that's another conversation. From my side, I would like to have this as part of aider-ce, with the proviso that it will be upgraded in the future to handle ALL of git functionality (if possible) - or at least more stuff. The current implementation does not interfere at all with Aider doing auto commits, or /git mode, that is a separate process (but uses the same Python library). |
|
I think expanding git tool capabilities over time is a good one! I don't think it's problematic for navigator mode to handle git commands explicitly and command_string is definitely suspiciously powerful. There almost certainly should be a navigator mode configuration at some point for things like allowed tool calls, and allowed executables it can run and forced confirmations. Something I'll keep in mind. I will merge this in the version I make today, though so very much appreciate the contribution! |
Added a new git.py in tools and some code to make it work in navigator_coder.py
Also changed pyproject.toml, not sure about this part but it was necessary to make it work.
Result: Aider Navigator can now use git. Ask it to check the diff between branches (good to re-implement the bits that LLM's always miss when re-factoring for example). I even simulated a merge conflict and it dealt with that easily.
Despite the additions here only dealing with read-only commands like diff, log, show and status, Navigator was able to do other git operations when asked such as commit and merge, using the command_string tool. This brings up the question:
Is this new git functionality necessary?
I am going to let the AI answer that one:
Looking at the new git tools, they're actually quite valuable and serve a different purpose than the
command_stringtool. Here's why they're necessary:Key Differences:
ANY_GIT_ERROR, providing better user feedback than raw command execution.coder.repoinfrastructure, which means they work with aider's git abstraction layer rather than just shelling out.git reset --hardorgit pushare exposed.Comparison:
command_string: General purpose, can run any shell command (including potentially dangerous ones)git_*tools: Specific, safe git operations with proper validation and error handlingThe git tools provide a safer, more structured way to access git functionality compared to raw shell commands, which aligns with aider's tool philosophy of providing controlled, well-defined operations.